<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>

<ul class="nav nav-tabs">
	<li class="active"><a href="<?php  echo $this->createWebUrl('tabbar',array('op' =>'display'))?>">底部导航</a></li>
	<li<?php  if(empty($adv['id']) && $operation == 'post') { ?> class="active" <?php  } ?>><a href="<?php  echo $this->createWebUrl('tabbar',array('op' =>'post'))?>">添加导航</a></li>
	
	<li style="background-color:red;color:#FFFFFF;"><a href="<?php  echo $this->createWebUrl('onekeytabbar')?>" onclick="return confirm('确认加载默认底部菜单吗？将覆盖你现有底部菜单数据，请谨慎操作！');return false;">一键加载默认底部菜单</a></li>
</ul>

<?php  if($operation == 'display') { ?>
<div class="main panel panel-default">
	<div class="panel-body table-responsive">
		<form action="" method="post">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:10%;">排序</th>
					<th>菜单会员等级</th>
					<th>名称</th>
					<th>图标</th>
					<th>是否关注公众号</th>
					<th>是否有推荐人</th>
					<th>是否生效</th>
					<th style="text-align:right;width:15%;">操作</th>
				</tr>
			</thead>
			<tbody>
				<?php  if(is_array($list)) { foreach($list as $adv) { ?>
				<tr>
					<td><input class="form-control" name="displayorder[<?php  echo $adv['id'];?>]" value="<?php  echo $adv['displayorder'];?>" type="text"></td>
					<td>
						<div><?php  if($adv['cateid']==61) { ?>普通会员<?php  } ?><?php  if($adv['cateid']==62) { ?>团长<?php  } ?><?php  if($adv['cateid']==63) { ?>合伙人<?php  } ?></div>
					</td>
					<td><?php  echo $adv['title'];?></td>
					<td class="text-center">
						<img src="<?php  echo tomedia($adv['thumb'])?>" style="width:40px;" />
					</td>
					<td><?php  if($adv['is_ios']==0) { ?>不设置<?php  } ?><?php  if($adv['is_ios']==1) { ?>是<?php  } ?><?php  if($adv['is_ios']==2) { ?>否<?php  } ?></td>
					<td><?php  if($adv['elmwm_act_id']==0) { ?>不设置<?php  } ?><?php  if($adv['elmwm_act_id']==1) { ?>是<?php  } ?><?php  if($adv['elmwm_act_id']==2) { ?>否<?php  } ?></td>
					<td><?php  if($adv['is_show']==1) { ?>生效<?php  } else { ?>隐藏<?php  } ?></td>
					<td style="text-align:right;">
					    <a href="<?php  echo $this->createWebUrl('tabbar', array('op' => 'show', 'id' => $adv['id']))?>" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="<?php  if($adv['is_show'] == 1) { ?>隐藏<?php  } ?>"><?php  if($adv['is_show'] == 1) { ?>隐藏<?php  } ?><?php  if($adv['is_show'] == 0) { ?>生效<?php  } ?></a>
						<a href="<?php  echo $this->createWebUrl('tabbar', array('op' => 'post', 'id' => $adv['id']))?>" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>
						<a href="<?php  echo $this->createWebUrl('tabbar', array('op' => 'delete', 'id' => $adv['id']))?>"class="btn btn-default btn-sm" onclick="return confirm('此操作不可恢复，确认删除？');return false;" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				<?php  } } ?>
				<tr>
					<td colspan="6">
						<input name="submit" class="btn btn-primary" value="提交" type="submit">
						<input name="token" value="<?php  echo $_W['token'];?>" type="hidden">
					</td>
				</tr>
			</tbody>
		</table>
		</form>
	</div>
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
<?php  } else if($operation == 'post') { ?>

<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
		<input type="hidden" name="id" value="<?php  echo $adv['id'];?>" />
		<div class="panel panel-default">
			<div class="panel-heading">
				导航设置
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[displayorder]" class="form-control" value="<?php  echo $adv['displayorder'];?>" />
						<span class="help-block">降序</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">导航会员等级设置：</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="61" <?php  if($adv['cateid'] == 61) { ?>checked="true"<?php  } ?> /> 普通会员</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="62" <?php  if($adv['cateid'] == 62) { ?>checked="true"<?php  } ?> /> 团长</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="63" <?php  if($adv['cateid'] == 63) { ?>checked="true"<?php  } ?> /> 合伙人</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否关注公众号才显示：</label>
					<div class="col-sm-9 col-xs-12">
					    <label class="radio-inline"><input type="radio" name="data[is_ios]" value="0" <?php  if($adv['is_ios'] == 0) { ?>checked="true"<?php  } ?><?php  if(!$adv['is_ios']) { ?>checked="true"<?php  } ?> /> 不限制</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[is_ios]" value="1" <?php  if($adv['is_ios'] == 1) { ?>checked="true"<?php  } ?> /> 关注才显示</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[is_ios]" value="2" <?php  if($adv['is_ios'] == 2) { ?>checked="true"<?php  } ?> /> 没关注才显示</label>
						<span class="help-block" style="color:#f00">是否关注公众号才显示导航</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否有推荐人才显示：</label>
					<div class="col-sm-9 col-xs-12">
					    <label class="radio-inline"><input type="radio" name="data[elmwm_act_id]" value="0" <?php  if($adv['elmwm_act_id'] == 0) { ?>checked="true"<?php  } ?><?php  if(!$adv['elmwm_act_id']) { ?>checked="true"<?php  } ?> /> 不限制</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[elmwm_act_id]" value="1" <?php  if($adv['elmwm_act_id'] == 1) { ?>checked="true"<?php  } ?> /> 有推荐人才显示</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[elmwm_act_id]" value="2" <?php  if($adv['elmwm_act_id'] == 2) { ?>checked="true"<?php  } ?> /> 没有推荐人才显示</label>
						<span class="help-block" style="color:#f00">是否有推荐人才显示导航</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">导航文字：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='title' name="data[title]" class="form-control" value="<?php  echo $adv['title'];?>" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">选中状态图标</label>
					<div class="col-sm-9">
						<?php  echo tpl_form_field_image('data[thumb]', $adv['thumb'], '', array('width' => 200, 'height' => 200))?>
						<span class="help-block" style="color:#f00">选中状态图标，建议尺寸200X200像素</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">未选中状态图标</label>
					<div class="col-sm-9">
						<?php  echo tpl_form_field_image('data[waimaitt_list_leftupicon]', $adv['waimaitt_list_leftupicon'], '', array('width' => 200, 'height' => 200))?>
						<span class="help-block" style="color:#f00">未选中状态图标，建议尺寸200X200像素</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">菜单跳转类型：</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline"><input type="radio" name="data[adtype]" value="1" <?php  if($adv['adtype'] == 1) { ?>checked="true"<?php  } ?> /> 跳转小程序</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[adtype]" value="4" <?php  if($adv['adtype'] == 4) { ?>checked="true"<?php  } ?> /> 小程序内部链接</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[adtype]" value="5" <?php  if($adv['adtype'] == 5) { ?>checked="true"<?php  } ?> /> 网页链接</label>
					</div>
				</div>
				<div class="form-group" style="display:none;">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">跳转小程序类型：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[appid_type]" value="0" checked="true" /> 跳其他小程序</label>
						</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">跳转小程序appid：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[appid]" class="form-control" value="<?php  echo $adv['appid'];?>" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">跳转小程序path：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[path]" class="form-control" value="<?php  echo $adv['path'];?>" />
						<span class="help-block" style="color:red;">*如果选择上面的跳转红包，则不需要填写，系统会自动补全</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">小程序内部路径或网页链接：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[url]" class="form-control" value="<?php  echo $adv['url'];?>" />
					</div>
				</div>
				<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否生效：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[is_show]" value="1" <?php  if($adv['is_show'] == 1) { ?>checked="true"<?php  } ?> /> 生效</label>
							&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[is_show]" value="0" <?php  if($adv['is_show'] == 0) { ?>checked="true"<?php  } ?> /> 隐藏</label>
						</div>
				</div>

				
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="<?php  echo $_W['token'];?>" />
		</div>
	</form>
</div>
<br/><br/><br/>
<div class="main">
        <div class="panel panel-default">
			<div class="panel-heading">
				【小程序内部路径、公众号小程序路径】：
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">小程序内部路径：</label>
					<div class="col-sm-9 col-xs-12">
						<a href="<?php  echo $this->createWebUrl('malllist',array('type' =>'xcxpath'))?>" target="_blank">点击查看</a>
						<span class="help-block" style="color:red;">*类型选择：小程序内部路径</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">公众号小程序路径：</label>
					<div class="col-sm-9 col-xs-12">
						<a href="<?php  echo $this->createWebUrl('malllist',array('type' =>'gzhpath'))?>" target="_blank">点击查看</a>
						<span class="help-block" style="color:red;">*类型选择：小程序内部路径</span>
					</div>
				</div>
			</div>
		</div>
</div>

<?php  } ?>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/footer', TEMPLATE_INCLUDEPATH)) : (include template('common/footer', TEMPLATE_INCLUDEPATH));?>